package defpackage; import cn.wps.core.runtime.Platform; import cn.wps.moffice.main.ad.s2s.CommonBean; import cn.wps.show.app.KmoPresentation; import defpackage.aua; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; /* renamed from: uuk reason: default package */ public final class uuk { private static HashMap<tsn, Integer> vMZ; private static HashMap<tsn, Integer> vNa; private static int vNb = 0; public static int vNc = 0; private aua bpJ; private bbo brv; private cls ckF; private KmoPresentation kVG; private tsn vKU; public uuk(KmoPresentation kmoPresentation, cls cls, tsn tsn) { this.kVG = kmoPresentation; this.ckF = cls; this.vKU = tsn; this.bpJ = aua.r(tsn.Jy()); } private static void a(coj coj, aua.b bVar, String str, String str2, bbo bbo) { if (bVar != null) { coj.N(str, str2); new baj(bVar.YZ(), bbo, "a", "spPr").a(coj); new bbd(bVar.Zb()).a(coj); new bbf(bVar.Lh(), "a", "lstStyle", bbo).a(coj); if (bVar.Zf()) { new bbc(bVar.Ze(), "a", CommonBean.new_inif_ad_field_style).a(coj); } coj.O(str, str2); } } private static void a(coj coj, aua aua) { if (aua.YQ()) { coj.N("a", "custClrLst"); ArrayList<arp> arrayList = new ArrayList(); aua.YP().c(arrayList); for (arp arp : arrayList) { coj.N("a", "custClr"); if (arp.zC()) { coj.J("name", arp.name()); } azz.a(coj, arp.NL()); coj.O("a", "custClr"); } coj.O("a", "custClrLst"); } } private static void a(OutputStream outputStream, aua aua, bbo bbo) { alc.assertNotNull(aua); alc.assertNotNull(outputStream); col col = new col(outputStream); col.startDocument(); col.N("a", "theme"); col.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); if (aua.zC()) { col.J("name", aua.name()); } col.N("a", "themeElements"); azy.a(col, aua.YJ()); bab.a(col, aua.YL()); new bbj(aua.YN(), "a", "fmtScheme", bbo).a(col); col.O("a", "themeElements"); if (aua.YU() || aua.YW() || aua.YY()) { col.N("a", "objectDefaults"); if (aua.YW()) { a(col, aua.YV(), "a", "spDef", bbo); } if (aua.YU()) { a(col, aua.YT(), "a", "lnDef", bbo); } if (aua.YY()) { a(col, aua.YX(), "a", "txDef", bbo); } col.O("a", "objectDefaults"); } if (aua.YS()) { col.N("a", "extraClrSchemeLst"); ArrayList<aua.c> arrayList = new ArrayList(); aua.YR().c(arrayList); for (aua.c cVar : arrayList) { col.N("a", "extraClrScheme"); azy.a(col, cVar.YJ()); if (cVar.Zi()) { atr Zh = cVar.Zh(); col.N("a", "clrMap"); col.J("bg1", bbp.bqV.get(Integer.valueOf(Zh.Xm()))); col.J("tx1", bbp.bqV.get(Integer.valueOf(Zh.Xq()))); col.J("bg2", bbp.bqV.get(Integer.valueOf(Zh.Xo()))); col.J("tx2", bbp.bqV.get(Integer.valueOf(Zh.Xs()))); col.J("accent1", bbp.bqV.get(Integer.valueOf(Zh.Xu()))); col.J("accent2", bbp.bqV.get(Integer.valueOf(Zh.Xw()))); col.J("accent3", bbp.bqV.get(Integer.valueOf(Zh.Xy()))); col.J("accent4", bbp.bqV.get(Integer.valueOf(Zh.XA()))); col.J("accent5", bbp.bqV.get(Integer.valueOf(Zh.XC()))); col.J("accent6", bbp.bqV.get(Integer.valueOf(Zh.XE()))); col.J("hlink", bbp.bqV.get(Integer.valueOf(Zh.XG()))); col.J("folHlink", bbp.bqV.get(Integer.valueOf(Zh.XI()))); col.O("a", "clrMap"); } col.O("a", "extraClrScheme"); } col.O("a", "extraClrSchemeLst"); } a(col, aua); col.O("a", "theme"); col.endDocument(); } /* JADX WARNING: Removed duplicated region for block: B:16:0x003b */ /* JADX WARNING: Removed duplicated region for block: B:18:0x0040 */ /* JADX WARNING: Removed duplicated region for block: B:23:0x004b */ /* JADX WARNING: Removed duplicated region for block: B:25:0x0050 */ /* JADX WARNING: Removed duplicated region for block: B:29:0x0058 */ /* JADX WARNING: Removed duplicated region for block: B:31:0x005d */ /* JADX WARNING: Removed duplicated region for block: B:44:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:46:? A[RETURN, SYNTHETIC] */ public static void e(tsn tsn) { File file; Throwable th; IOException e; FileNotFoundException e2; FileOutputStream fileOutputStream = null; try { file = File.createTempFile("fds-theme-", ".xml", new File(Platform.getTempDirectory())); try { FileOutputStream fileOutputStream2 = new FileOutputStream(file); try { a(fileOutputStream2, aua.r(tsn.Jy()), null); tsn.eXh = file.getAbsolutePath(); if (fileOutputStream2 != null) { lul.a(fileOutputStream2); } if (file != null) { file.deleteOnExit(); } } catch (FileNotFoundException e3) { e2 = e3; fileOutputStream = fileOutputStream2; try { e2.printStackTrace(); if (fileOutputStream != null) { lul.a(fileOutputStream); } if (file != null) { file.deleteOnExit(); } } catch (Throwable th2) { th = th2; if (fileOutputStream != null) { lul.a(fileOutputStream); } if (file != null) { file.deleteOnExit(); } throw th; } } catch (IOException e4) { e = e4; fileOutputStream = fileOutputStream2; e.printStackTrace(); if (fileOutputStream != null) { lul.a(fileOutputStream); } if (file != null) { file.deleteOnExit(); } } catch (Throwable th3) { th = th3; fileOutputStream = fileOutputStream2; if (fileOutputStream != null) { } if (file != null) { } throw th; } } catch (FileNotFoundException e5) { e2 = e5; e2.printStackTrace(); if (fileOutputStream != null) { } if (file != null) { } } catch (IOException e6) { e = e6; e.printStackTrace(); if (fileOutputStream != null) { } if (file != null) { } } } catch (FileNotFoundException e7) { e2 = e7; file = null; e2.printStackTrace(); if (fileOutputStream != null) { } if (file != null) { } } catch (IOException e8) { e = e8; file = null; e.printStackTrace(); if (fileOutputStream != null) { } if (file != null) { } } catch (Throwable th4) { th = th4; file = null; if (fileOutputStream != null) { } if (file != null) { } throw th; } } private void fPi() throws IOException { vMZ.put(this.vKU, Integer.valueOf(vNb)); cls a = uul.a(this.ckF, vNb); this.brv = new uug(this.kVG, a.apK()); a(uul.a(a), this.bpJ, this.brv); this.brv.nq(); } public static void initialize() { vMZ = new HashMap<>(); vNa = new HashMap<>(); vNb = 0; vNc = 0; } public final boolean fPj() throws IOException { vNb++; fPi(); return true; } public final boolean fPk() throws IOException { if (vNa.containsKey(this.vKU)) { this.ckF.apK().a(ckw.cha, vNa.get(this.vKU).intValue()); } else { vNc++; fPl(); } return true; } public void fPl() { vNa.put(this.vKU, Integer.valueOf(vNc)); cls b = uul.b(this.ckF, vNc); this.brv = new uug(this.kVG, b.apK()); col col = new col(uul.a(b)); col.startDocument(); col.N("a", "themeOverride"); col.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); if (this.bpJ.YK()) { azy.a(col, this.bpJ.YJ()); } if (this.bpJ.YM()) { bab.a(col, this.bpJ.YL()); } if (this.bpJ.YO()) { new bbj(this.bpJ.YN(), "a", "fmtScheme", this.brv).a(col); } col.O("a", "themeOverride"); col.endDocument(); } public final boolean np() throws IOException { if (vMZ.containsKey(this.vKU)) { this.ckF.apK().a(ckw.cgZ, vMZ.get(this.vKU).intValue()); } else { vNb++; fPi(); } return true; } }